﻿/****************************************************************************************************
	Copyright (C) 2010 RapidWebDev Organization (http://rapidwebdev.org)
	Author: Eunge, Legal Name: Jian Liu, Email: eunge.liu@RapidWebDev.org

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 2 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ****************************************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lucene.Net.Search;
using RapidWebDev.SearchIndex.Contract;
using Lucene.Net.Documents;

namespace RapidWebDev.SearchIndex
{
	/// <summary>
	/// Interface to access indexing document field.
	/// </summary>
	public interface IDocumentField
	{
		/// <summary>
		/// Indexing document field type.
		/// </summary>
		IndexDocFieldValueTypes FieldType { get; }

		/// <summary>
		/// Resolve original field value from Lucene stored field value.
		/// </summary>
		/// <param name="luceneStoredFieldValue"></param>
		/// <returns></returns>
		string ResolveOriginalFieldValue(string luceneStoredFieldValue);

		/// <summary>
		/// Convert indexing document field message to lucene fields.
		/// </summary>
		/// <param name="indexDocField"></param>
		/// <returns></returns>
		Fieldable[] GetLuceneFields(IndexDocFieldMessage indexDocField);

		/// <summary>
		/// Append the search filter to the query to run.
		/// </summary>
		/// <param name="queryToRun"></param>
		/// <param name="searchFilterMessage"></param>
		/// <param name="stemmingLanguage"></param>
		/// <returns></returns>
		void AppendQuery(BooleanQuery queryToRun, SearchFilterMessage searchFilterMessage, string stemmingLanguage);
	}
}
